package com.imooc.infra.repository.jdbc.params;

import com.imooc.module.collect.enums.DimensionEnum;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
public class StandardSqlParam {
    //业务id
    public static final String BUSINESS_ID = "business_id";
    public static final String RULE_ID = "rule_id";
    //群组id
    public static final String GROUP_IDS = "group_ids";
    //开始时间
    public static final String START_TIME = "start_time";
    //结束时间
    public static final String END_TIME = "end_time";

    public static final String USER_ID = "user_id";

    public static final String USER_IDS = "user_ids";
    public static final String GROUP_ID = "group_id";
    public static final String SCHOOL_ID = "school_id";

    /**
     * 统计时间
     */
    public static final String COUNT_TIME = "count_time";
    public static final String DATE_PATTERN = "yyyyMMdd";
    public static final String REQUEST_TIME = "request_time";

    /**
     * 获取对应维度的数据库字段
     * @param dimension
     * @return
     */
    public static String getDimensionColumn(DimensionEnum dimension) {
        return switch (dimension) {
            case USER -> USER_ID;
            case GROUP -> GROUP_ID;
            case SCHOLL -> SCHOOL_ID;
        };
    }
}
